package com.juitar.base.fingering;

import java.util.Comparator;

import com.juitar.base.Fingering;


public class FingeringComparator implements Comparator<Fingering> {

	public int compare(Fingering f1, Fingering f2) {
		int diff = f1.getFirstFret() - f2.getFirstFret();
		if (diff != 0) {
			//Less frets first
			return diff;
		} 
		
		int inv = f1.getInversion() - f2.getInversion();
		if (inv != 0) {
			//Less inversion first
			return inv;
		} else {
			//More strings first
			return f1.numOfMutedStrings() - f2.numOfMutedStrings();
		}
	}
}
